<?php 
	include "init.php";
	date_default_timezone_set('Asia/Shanghai');
	$code=mb_convert_encoding($_SESSION['str'], 'UTF-$8','GBK');
	
	if (!empty($_POST['cap_word'])&&$_POST['cap_word']==$code) {
		echo json_encode(array('code'=>'400','msg'=>'保存失败！'));
	}
	if (!empty($_POST['contact_name'])&&!empty($_POST['contact_email'])&&!empty($_POST['contact_telephone'])&&!empty($_POST['contact_message'])) {
		$contact_name = addslashes($_POST['contact_name']);
		$contact_email = addslashes($_POST['contact_email']);
		$contact_telephone = addslashes($_POST['contact_telephone']);
		$contact_message = addslashes($_POST['contact_message']);
		$contact_time=time();
		

		$sql="INSERT INTO `contact`( `contact_name`, `contact_email`, `contact_telephone`, `contact_message`, `contact_time`) VALUES ('{$contact_name}','{$contact_email}','{$contact_telephone}','{$contact_message}','{$contact_time}')";

		$mysql->query($sql);
		
		echo json_encode(array('code'=>'000','msg'=>'保存成功'));
		// header("location:single.php?art_id=".$_POST['article_id']);
		exit;
	}
?>